package com.zzyl.task;

import com.zzyl.mapper.CustomerReservationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class TimeTask {
    @Autowired
    CustomerReservationMapper customerReservationMapper;

    //删除这一天中的数据 0小时 0分钟的时候
    @Scheduled(cron = "59 59 23 * * ?")
    public void DeleteExpire(){
        customerReservationMapper.deleteExpireData();
    }
    //更改数据状态
    @Scheduled(cron = "0 1,31 * * * ?")
    public void updateExpire(){
        customerReservationMapper.updateExpireData();
    }
//    void deleteExpireData();
//
//    void updateExpireData();

//    @Scheduled(cron = "0/2 * * * * ?")
//    public void executeTask(){
//        System.out.println("定时任务开始执行：{}"+ LocalDateTime.now());
//    }

}
